home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj8408.arc
/
RANDOM2.BAS
< prev
next >
Wrap
BASIC Source File
|
1984-05-11
|
1KB
|
43 lines
10 ' Correlated variable display
20 ' showing problems with RND function
30 ' -by P. F. Hultquist, 1983
40 '
50 DIM ARRAY(50) : SCREEN 2 : CLS : KEY OFF
60 ' W,X,Y,Z are obtained from successive calls to RND
70 ' and then used to generate coordinates of display
80 ' points
85 GOSUB 1000
90 FOR K = 1 TO 5000
100 GOSUB 1100
101 W = V : GOSUB 1100
102 X = V : GOSUB 1100
103 Y = V : GOSUB 1100
104 Z = V
110 I = 100 + 425*(.3*W + .4*X + .3*Y)
120 J = 25 + 150*(.3*X + .4*Y + .3*Z)
130 PSET(I,J)
140 NEXT K
150 ' Print label for display
160 LINE (25,10)-(600,10)
170 LINE -(600,190)
180 LINE -(25,190)
190 LINE -(25,10)
200 LOCATE 23,35
210 PRINT "Figure 2"
220 GOTO 2000
1000 ' Modification of random number generation
1010 ' to introduce "randomizer"
1020 FOR K = 1 TO 50
1030 ARRAY(K) = RND
1040 NEXT K
1050 ' This loads the array with random numbers
1060 ' to be used in the randomization
1070 SPARE = RND
1080 RETURN
1090 ' Enter here on succeeding calls
1100 KA = INT(SPARE*50) + 1
1110 SPARE = ARRAY(KA)
1120 V = SPARE : ARRAY(KA) = RND
1130 RETURN
2000 END